package com.tanhua.dubbo.db.api;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.dubbo.db.mappers.FreezeMapper;
import com.tanhua.model.db.Freeze;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class FreezeApiImpl implements FreezeApi {
    @Autowired
    private FreezeMapper freezeMapper;

    //根据userId查询该表
    public Freeze findFreezeByUserId(Long userId) {
        QueryWrapper qw = new QueryWrapper();
        qw.eq("user_id",userId);
        return freezeMapper.selectOne(qw);
    }

    //保存冻结信息
    public void freeze(Freeze freeze) {
        freezeMapper.insert(freeze);
    }

    //更新冻结信息
    public void update(Freeze isHave) {
        freezeMapper.updateById(isHave);
    }
}
